package com.zzg.springboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.zzg.springboot.dao.book.BookRepository;
import com.zzg.springboot.entity.Book;

@Controller
@RequestMapping("/api/springboot")
public class BookController {
	@Autowired
	private BookRepository repository;
	
	@RequestMapping(value="/book/init", method={RequestMethod.GET})
	public void init(){
		for(int i =0; i < 5; i++){
			Book book = new Book();
			book.setName("name:" + i);
			repository.save(book);
		}
	}

}
